package net.lab1024.sa.admin.module.business.category.controller;

import net.lab1024.sa.admin.module.business.category.domain.entity.*;
import net.lab1024.sa.admin.module.business.category.service.SynthesisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/synthesis")
public class SynthesisController {

    @Autowired
    SynthesisService synthesisService;

    @PostMapping("/analyze1")
    public ResponseEntity<RetroResponse.RetroResult2> analyze(
            @RequestBody SynthesisRequest request) {

//        SynthesisTree result = synthesisService.analyze(request.getSmiles());
        RetroResponse.RetroResult2 result = synthesisService.analyze(request.getSmiles());
        return ResponseEntity.ok(result);
    }

    //    @GetMapping("/visualize/{id}")
    //    public void visualizeTree(@PathVariable String id, HttpServletResponse response) {
    //        SynthesisTree tree = treeService.getTree(id);
    //        // 生成PNG/SVG图像
    //        imageService.renderTree(tree, response.getOutputStream());
    //    }
}

